package com.github.shiqiyue.app.common.exception;


import com.github.shiqiyue.app.common.result.ResultCode;

/***
 * 业务异常
 * @author wenyao.wu
 */
public class BusinessException extends RuntimeException {

    private Integer code;

    public BusinessException() {
    }

    public BusinessException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message, Integer code, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.code = ResultCode.COMMON_FAIL;
    }

    public BusinessException(Throwable cause) {
        super(cause);
        this.code = ResultCode.COMMON_FAIL;
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.code = ResultCode.COMMON_FAIL;
    }

    public BusinessException(String message) {
        super(message);
        this.code = ResultCode.COMMON_FAIL;
    }

    public Integer getCode() {
        return code;
    }
}
